-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Policy/policy.open-cluster-management.io stuck in progressing status when no clusters match the policy (#21296) #21297
base: master
Are you sure you want to change the base?
Conversation
…atus when no clusters match the policy (argoproj#21296) When a policy does not apply to a cluster because the placementrule matches no cluster at all then the status will look like the following: status: placement: - placementBinding: group-one-placement-binding placementRule: group-one-placement Without this change the above will show up as progressing even though there is really nothing to progress. Let's take care of this case by returning healthy when there is no compliant field but the array under placement is non-zero, which means that its placement resolution has happened and there is nothing to do. Fixes: argoproj#21296 Signed-off-by: Michele Baldessari <[email protected]>
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #21297 +/- ##
==========================================
- Coverage 55.23% 53.29% -1.94%
==========================================
Files 337 337
Lines 57055 57055
==========================================
- Hits 31515 30409 -1106
- Misses 22847 24001 +1154
+ Partials 2693 2645 -48 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update, @mbaldessari!
FYI @JustinKuli
-- it is not being applied to any clusters | ||
if obj.status.compliant == nil and #obj.status.placement > 0 then | ||
hs.status = "Healthy" | ||
hs.message = "No clusters are matching this policy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wording
hs.message = "No clusters are matching this policy" | |
hs.message = "No clusters match this policy" |
-- A policy will not have a compliant field but will have a placement key set if | ||
-- it is not being applied to any clusters | ||
if obj.status.compliant == nil and #obj.status.placement > 0 then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An additional conditional is required for the case where clusters were matched but are not yet reporting status.
-- A policy will not have a compliant field but will have a placement key set if | |
-- it is not being applied to any clusters | |
if obj.status.compliant == nil and #obj.status.placement > 0 then | |
-- A policy will not have a compliant field but will have a placement key set if | |
-- it is not being applied to any clusters | |
if obj.status.compliant == nil and #obj.status.placement > 0 and obj.status.status == nil then |
When a policy does not apply to a cluster because the placementrule matches no cluster at all then the status will look like the following:
Without this change the above will show up as progressing even though there is really nothing to progress.
Let's take care of this case by returning healthy when there is no compliant field but the array under placement is non-zero, which means that its placement resolution has happened and there is nothing to do.
Fixes: #21296
Ideally this should be backported to release-2.13 (only)
Checklist: